package parsehtml;

import java.io.*;
import java.net.*;
import java.util.logging.Level;
import java.util.logging.Logger;

public class URLreader {


    public String read(String urlArg) throws IOException {
 
        URL url = null;
        try {
            url = new URL(urlArg);
        } catch (MalformedURLException ex) {
            Logger.getLogger(URLreader.class.getName()).log(Level.SEVERE, null, ex);
        }

        BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
        
        HTML2Text parse = new HTML2Text();
        parse.parse(reader);
        
        String htmlDoc = new String();

//        String line = new String();
//        while ((line = reader.readLine()) != null) {
//            htmlDoc += line + "\n";
//        }

        reader.close();
        return parse.getText();
    }
}
